<?php
function smarty_block_arclist($params, $content, &$smarty)
{
//	var_dump($content);
	$cid = isset($params['cid']) ? $params['cid'] : null;
	$row = isset($params['row']) ? $params['row']: 1000;
	if($cid){
		$sql = "select * from diary where cid=$cid limit $row";
	}else{
		$sql = "select * from diary limit $row";
	}
	
	//query是一个函数，参考functions.php
	$data = query($sql);
	var_dump($data);
	
	$str = "";
	foreach ($data as $k => $v) {
		$c = $content;
		foreach ($v as $key => $value) {
			$c = str_replace("[\$filed.{$key}]", $value, $c);
		}
		$str .=$c;
	}
	return $str;
}


/* vim: set expandtab: */

?>
